import Vue from "vue";
import VueRouter from "vue-router";
import Home from "@/views/Home.vue";

Vue.use(VueRouter);

const routes = [
    {
        path: "/",
        component: Home,

    },
    {
        path: "/login",
        component: () => import("../views/Login.vue")//懒加载
    }, {
        path: "/home",
        component: () => import("../views/Home.vue"),
        children: [
            {
                path: "user",
                component: () => import("../views/User.vue")//懒加载
            }, {
                path: "goods",
                component: () => import("../views/goods.vue")//懒加载
            }
        ]
    }
];
const router = new VueRouter({
    mode: "history",
    base: process.env.BASE_URL,
    routes
});

export default router;
